<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="vue.js"></script>
</head>

<body>
    <div id="app">
        <button @click="add">增加</button>
        <!-- <div v-for="(item,index) in arr" :key='item.id'>{{index}} ={{item}}</div> -->
        <!-- <div v-for='item in filterArr' :key="item.id">{{item.title}}</div> -->
        <div v-for='item in filterArr' :key="item.id">{{item}}</div>
    </div>
    <script>
        let vm = new Vue({
            el: "#app",
            data: {
                arr: [{
                        id:1,title: "111",is:false
                    },
                    {
                       id:2,title: "222",is:true
                    }
                ], 
            },
            computed:{
                filterArr(){
                    // return this.arr.filter((item)=>{
                    //     return item.is
                    // })
                    return this.arr.concat([1,2,3])
                }
            },

            methods:{
                add(){
                    // this.arr.push({
                    //     id:3,
                    //     title:333
                    // })
                    //强制更新  对象也可以修改
                    this.$set(this.arr,1,{
                        id:3,
                        title:"修改过后的"
                    })
                }
            }
        })
    </script>
</body>

</html>